#ifndef __MQTT_SRC_H
#define __MQTT_SRC_H

#define pbuf_MAX_SIZE	1500 
#define mqtt_malloc malloc
#define debug 1

#include "string.h"
#include "stdlib.h"


#if debug 1

#ifdef __ARMGCC__
#define Debug (x)  printf(#x)
#endif

#ifdef cplusplus 
#include "iostream"
#define Debug(x)  std::cout<<x<<std::endl
#endif
#endif


enum QoSLevel{
	QoS0 = 0, QoS1, QoS2
};

struct Mqtt_info {

	unsigned char* pbuf;
	const char* ip;
	int host;

	int dataSize;

	const char* clientID;
	const char* userName;
	const char* Password;
	enum QoSLevel QoS;
	int liveTime;

	char (*create_connect_msg)(struct Mqtt_info* );
	void (*create_subscribeTopic_msg)(struct Mqtt_info*, const char*, QoSLevel);
	void (*create_publishNew_msg)(struct Mqtt_info* , const char* , const char* );
	void (*create_keepLive_msg)(struct Mqtt_info* );
	char (*send_data)(unsigned char* , int);
	void (*set_userName_passWord)(struct Mqtt_info* mq, const char* username, const char* passWord);

};

char Mqtt_Init(struct Mqtt_info* mq, const char* ip, const char* clientID, int host);
char tcp_sendData(unsigned char* pbuf, int len);

#endif
